package item.inkcloud.distributionservice.controller;


import item.inkcloud.distributionservice.entity.UserInfo;
import item.inkcloud.distributionservice.mapper.UserNearByMapper;
import item.inkcloud.distributionservice.service.UserNearByService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;



@RestController
@RequestMapping("/nearBy")
public class NearByUserController {

    @Autowired
    UserNearByService userNearByService;

    @RequestMapping("/nearByUser")
    public HashMap nearByUser(@RequestParam("province") String province){
        HashMap<String,Object> resultMap = new HashMap();

        ArrayList<UserInfo> resultData = userNearByService.getNearByUser(province);

        if (resultData!= null){
            resultMap.put("status",1);
            resultMap.put("data",resultData);

        }else {

            resultMap.put("status",0);
            resultMap.put("data",resultData);
        }


        return resultMap;
    }

}
